import { getInterViewLists, getArrangeDetilInfo, getModifyFeedBackInfo } from '../../fetch/modules/arrange'

const state = {
    arrangeLists: {
    },
    arrangeDetailInfo: {},
    saveFeedBackInfo: {}
}

const actions = {
    GET_INTER_VIEW_LISTS: ({ commit, state }, opts) => {
        return getInterViewLists(opts).then(inter => commit('FETCH_INTER_VIEW_LISTS', { inter }))
    },
    FETCH_ARRANGE_DETAIL: ({ commit, state }, opts) => {
        return getArrangeDetilInfo(opts).then(inter => commit('FETCH_ARRANGE_DETAIL_INFO', { inter }))
    },
    FETCH_INTER_VIEW_INPINFO: ({ commit, state }, opts) => {
        return getModifyFeedBackInfo(opts).then(inter => commit('SAVE_FEEDBACK_INFO', { inter }))
    }
}
const mutations = {
    FETCH_INTER_VIEW_LISTS: (state, { inter }) => {
        state.arrangeLists = inter.data;
    },
    FETCH_ARRANGE_DETAIL_INFO: (state, { inter }) => {
        state.arrangeDetailInfo = inter.data;
    },
    SAVE_FEEDBACK_INFO: (state, { inter }) => {
        state.saveFeedBackInfo = inter.data;
    },
}

const getters = {
    getArrangeLists (state) {
        return state.arrangeLists
    },
    getArrangeDetailInfo(state) {
        return state.arrangeDetailInfo
    },
    saveFeedBackInfo(state) {
        return state.saveFeedBackInfo
    },
}

export default {
    state,
    actions,
    mutations,
    getters
}